package untiring.beans;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import untiring.interfaces.OrderDAO;
import untiring.models.CartVO;
import untiring.models.OrderVO;

@Repository("orderDAO")
public class OrderDAOimpl implements OrderDAO {

	
	@Autowired
	private SqlSession sqlSession;
	
	@Override
	public boolean insertOrder(OrderVO o) {
		boolean result = false;
		return result;
	}

	@Override
	public List<OrderVO> selectOrder() {
		return sqlSession.selectList("productMapper.selectOrder");
	}

	@Override
	public OrderVO selectOneOrder(String ono) {
		return sqlSession.selectOne("productMapper.viewOrder",ono);
	}

	@Override
	public boolean updateOrder(OrderVO o) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean deleteOrder(String ono) {
		// TODO Auto-generated method stub
		return false;
	}
	
	

	@Override
	public OrderVO selectImage(OrderVO o) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public boolean insertCart(CartVO c) {
		boolean result = false;
		System.out.println(c.getPno());
		System.out.println(c.getSize());
		System.out.println(c.getCnum());
		if(sqlSession.insert("orderMapper.insertCart",c)>0 )result = true;
		return result;
	}
	
	@Override
	public List<CartVO> selectCart() {
		return sqlSession.selectList("orderMapper.selectCart");
	}

}
